<%--
  Created by IntelliJ IDEA.
  User: 葭月盈亏
  Date: 2020/6/26
  Time: 11:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理页面</title>
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="./css/management.css">
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
    <script src="./js/management.js"></script>
</head>

<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark ">
    <a class="navbar-brand" href="#">后台管理页面</a>
    <div class="logo">Welcome To Manage Page</div>
    <button type="button" class="btn btn-outline-primary back-btn">返回首页</button>
</nav>
<form class="btn-add" action="/xcms/news">
    <input type="text" placeholder="请输入需要添加的新闻" class="form-control" name="title">
    <input type="hidden" value="add" name="action">
    <input type="submit" class="btn btn-success" value="添加新闻">
</form>
<div class="tablecard">
    <table class="table">
        <thead>
        <tr>
            <th scope="col">#</th>
            <th scope="col">新闻标题</th>
            <th scope="col">操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${page.records}" var="n">
        <tr>
            <td>${n.id}</td>
            <td>${n.title}</td>
            <td>
<%--                <a  href="${pageContext.request.contextPath }/news?action=showone&id=${n.id }">编辑</a>--%>
<%--                <a href="${pageContext.request.contextPath }/news?action=shownews&id=${n.id }">查看</a>--%>
<%--                <a href="${pageContext.request.contextPath }/news?action=delete&id=${n.id }" onclick="return confirm('你确认要删除吗？')">删除</a>--%>
                <a  class="btn btn-primary btn-sm " data-toggle=" tooltip " data-placement="left " title="查看"
                    href="${n.url}">
                    <svg class="bi bi-eye-fill" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                        <path d="M10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z"/>
                        <path fill-rule="evenodd" d="M0 8s3-5.5 8-5.5S16 8 16 8s-3 5.5-8 5.5S0 8 0 8zm8 3.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z"/>
                    </svg>
                </a>
                <a  class="btn btn-warning btn-sm " data-toggle=" tooltip " data-placement="left " title="编辑"
                    href="${pageContext.request.contextPath }/news?action=edit&id=${n.id }&title=${n.title}">
                    <svg class="bi bi-pencil-square" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
                        <path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456l-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/>
                        <path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z"/>
                    </svg>
                </a>
                <a  class="btn btn-danger btn-sm " data-toggle=" tooltip " data-placement="left " title="删除"
                    href="${pageContext.request.contextPath }/news?action=delete&id=${n.id } "onclick="return confirm('你确认要删除吗？')">
                    <svg class="bi bi-trash-fill " width="1em " height="1em " viewBox="0 0 16 16 " fill="currentColor " xmlns="http://www.w3.org/2000/svg">
                        <path fill-rule="evenodd " d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0
                            0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5a.5.5 0 0 0-1 0v7a.5.5 0 0 0 1 0v-7z "/>
                    </svg>
                </a>
            </td>
        </tr>
        </c:forEach>
        <ul >

            <li><a href="${pageContext.request.contextPath }/news?action=page&currPage=1">首页</a>
<%--            </li>--%>
<%--            <li>--%>
                <a
                    href="${pageContext.request.contextPath }/news?action=page&currPage=${page.totalpage-1==0?1:page.totalpage-1}"
                    aria-label="Previous"> <span aria-hidden="true">&laquo;</span>
            </a>
<%--            </li>--%>

            <%--        <c:forEach begin="${page.startPage}" end="${page.endPage}" var="num">--%>
            <%--        <li <c:if test="${page.pagenum==num}"> class="active" </c:if>><a--%>
            <%--                href="${page.servletUrl }&pagenum=${num}">${num }</a>--%>
            <%--            </c:forEach>--%>
<%--            <li>--%>
            <a href="${pageContext.request.contextPath }/news?action=page&currPage=${page.totalpage+1 <= page.totalpage?page.totalpage+1:page.totalpage}"
                    aria-label="Next"> <span aria-hidden="true">&raquo;</span>
            </a>
<%--            </li>--%>
<%--            <li>--%>
            <a href="${pageContext.request.contextPath }/news?action=page&currPage=12&currPage=${page.totalpage}">尾页</a>
            </li>
            <li>
            <a>第${page.currpage}页/共${page.totalpage}页</a></li>
        </ul>
        </tbody>
    </table>
</div>
<!-- 底部内容 -->
<footer>
    <span>参与人员：李奇隆 胡正开 刘瑞园 &emsp; 注：网站内容来自于互联网收集，若有侵权，会立即删除</span>
    <p>京ICP证666666号 &nbsp;
        <svg class="bi bi-tv-fill" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
            <path fill-rule="evenodd" d="M2.5 13.5A.5.5 0 0 1 3 13h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zM2 2h12s2 0 2 2v6s0 2-2 2H2s-2 0-2-2V4s0-2 2-2z"/>
        </svg> &emsp; 违法和不良信息举报电话400-111-1111<svg class="bi bi-phone" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
            <path fill-rule="evenodd" d="M11 1H5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM5 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H5z"/>
            <path fill-rule="evenodd" d="M8 14a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/>
        </svg>
    </p>
</footer>
</body>

</html>
